<template>
  <el-dialog :title="isAdd?'添加角色':'编辑角色'" :close-on-click-modal="false"
             :visible.sync="isShow" width="25%" @close="handleClose"
             :show-close="false">

    <el-form ref="form" :model="role" label-position="top">
      <el-form-item label="角色名称">
        <el-input v-model="role.roleName" placeholder="请输入角色名称"></el-input>
      </el-form-item>
      <el-form-item label="权限字符串">
        <el-input v-model="role.roleKey" placeholder="请输入权限字符串"></el-input>
      </el-form-item>
      <el-form-item label="权值">
        <el-input v-model="role.roleSort" placeholder="请输入角色权值（大于等于1的数字）"></el-input>
      </el-form-item>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button @click="closeDialog">取 消</el-button>
      <el-button type="primary" @click="handleSubmit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>

export default {
  data() {
    return {}
  },
  props: {
    isShow: {
      type: Boolean,
      default: false
    },
    role: {
      type: Object,
      default: {}
    },
    isAdd: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleClose() {
      this.$emit('handleClose')
    },
    closeDialog() {
      this.$emit('closeDialog')
    },
    handleSubmit() {
      this.$emit('handleSubmit', this.role)
    }
  }
}
</script>

<style scoped>

</style>
